﻿// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)

Shader "GJ/ProgressColor" {
Properties {
    [PerRendererData] _MainTex ("Main Texture", 2D) = "black" {}
    _Color ("Main Color", Color) = (1,1,1,1)
    _SColor ("Second Color", Color) = (1,1,1,1)
    _Progress("Progress",Range(0,1)) = 1
}
SubShader {
    Tags {
        "IgnoreProjector"="True"
        "Queue"="Transparent"
        "RenderType"="Transparent"
        "PreviewType"="Plane"
		"CanUseSpriteAtlas"="True"
    }
    Pass {
        Blend SrcAlpha OneMinusSrcAlpha
        Cull Off
        Lighting Off
        ZWrite Off
        Ztest Always
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"
		#include "UnityUI.cginc"

        sampler2D _MainTex; float4 _MainTex_ST;
        float4 _Color;
        float4 _SColor;
        float _Progress;

        struct appdata_t {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        v2f vert (appdata_t v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            float4 col = tex2D(_MainTex, i.uv);
            return col * lerp(_Color, _SColor, _Progress);
        }
        ENDCG
    }
}

}